package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import io.swagger.v3.oas.annotations.servers.Server;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {
    //新增订单细分数据
    @Insert("insert into order_detail(name, image, order_id, dish_id, setmeal_id, dish_flavor, number, amount) " +
            "values (#{name},#{image},#{orderId},#{dishId},#{setmealId},#{dishFlavor},#{number},#{amount})")
    void insert(OrderDetail orderDetail);

    //根据订单id获取订单细分数据
    @Select("select * from order_detail where order_id=#{orderId}")
    List<OrderDetail> getDetailByOrderId(Long orderId);

    //查询销量排名top10
    List<GoodsSalesDTO> saleCount(Map map);
}
